
/*
*
*  if (type.isReactComponent) {   //类
        let element = new type(props).render()   //调用render函数后，执行步骤和普通函数是一样的了
        type = element.type;
        props = element.props;

        //迭代递归：子元素函数或者类，会一直递归调用，知道解析出dom
        if (typeof  element.type == 'function') {
            return  render(element,parent)
        }


    } else if (typeof type === 'function') {
        let element = type(props);
        type = element.type;
        props = element.props;
        if (typeof  element.type == 'function') {
            return  render(element,parent)
        }



    }
  */



import React from './react';
import ReactDom from './react-dom';


function Grandson() {
    return <div>Grandson</div>
}


function Son() {
    return <Grandson/>
}

class Welcome extends React.Component {

    constructor(props) {
        super(props);   //  调用父类的
        this.props = props;   //可消除未被使用的警告

    }
    render() {
        return <Son/>
    }
}

let element = React.createElement(Welcome, {
    name: "ygg"
});

ReactDom.render(element, document.getElementById('root'));
